<?php

namespace app\controllers;
use \qore\cli\CliController;
use \qore\cli\CliHelper;
use \app\components\LocalRepository;

/**
 * @author Samuel Nogueira <samuel.nogueira.dev@gmail.com>
 */
class IndexController extends CliController {
	
	/**
	 * @return \app\components\LocalRepository
	 */
	public function getLocalRepository() {
		return LocalRepository::i();
	}
	
	/**
	 * Displays current status
	 */
	public function actionStatus() {
		$localRepository = $this->getLocalRepository();
		
		
		if (!$localRepository->getAllResources()) {
			return " There are no files in this folder\n";
		}
		
		if (!$localRepository->getChangedResources()) {
			return " All the files are up to date";
		}
		
		foreach ($localRepository->getAllResources() as $resource) {
			/* @var $resource \app\models\Resource */
			echo " ".$resource->status."\t".$resource->fileInfo->getFilename()."\n";
		}
	}
	
	protected function _getAllFiles() {
		
	}
}
